package com.callback.confirmreturndemo.config;

import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;



@Configuration
public class QueueBindExchangeConfig {


    public static final String QUEUE_NAME="queue";
    public static final String EXCHANGE_NAME="exchange";
    public static final String ROUTE_KEY="route_key";
    @Bean
    public Queue queue(){
        return QueueBuilder.nonDurable(QUEUE_NAME).autoDelete().build();
    }
    @Bean
    public DirectExchange exchange(){
        return ExchangeBuilder.directExchange(EXCHANGE_NAME).autoDelete().build();
    }
    @Bean
    public Binding binding(){
        return BindingBuilder.bind(queue()).to(exchange()).with(ROUTE_KEY);
    }
}
